layui.config({
    base: "/assets/iartisan/plugins/lib/"
}).use(['jquery', 'router', 'table', 'layer', 'ajaxTimeout'], function () {
    var router = layui.router, $ = layui.jquery, table = layui.table,
        layer = parent.layer === undefined ? layui.layer : top.layer,
        util = layui.util;

    var urls = {
        currval: "/seqSupport/currval",
        nextval: "/seqSupport/nextval",
        setval: "/seqSupport/setval",
        genOrderId: "/seqSupport/genOrderId"
    };

    $('.layui-btn').on('click', function () {
        let othis = $(this), attrEvent = othis.attr('lay-event');
        active[attrEvent] ? active[attrEvent].call(this) : '';
    });
    let active = {
        currval: function () {
            router.ajaxGet(
                urls.currval + "?seqName=test",
                {}, {},
                function (res) {
                    if (res.code = '000000') {
                        $("#currval").val(res.data);
                    }
                });
        },
        nextval: function () {
            router.ajaxGet(
                urls.nextval + "?seqName=test",
                {}, {},
                function (res) {
                    if (res.code = '000000') {
                        $("#nextval").val(res.data);
                    }
                });
        },
        setval: function () {
            router.ajaxGet(
                urls.setval + "?seqName=test&value=0",
                {}, {},
                function (res) {
                    if (res.code = '000000') {
                        $("#setval").val(res.data);
                    }
                });
        },
        genOrderId: function () {
            router.ajaxGet(
                urls.genOrderId + "?seqName=test",
                {}, {},
                function (res) {
                    if (res.code = '000000') {
                        $("#orderId").val(res.data);
                    }
                });
        }
    }

});